﻿<controls:MetroWindow x:Class="Wix.Win8SetupBootstrapper.Views.RootView"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                      xmlns:viewModels="clr-namespace:Wix.Win8SetupBootstrapper.ViewModels"
                      xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                      xmlns:behaviours="http://metro.mahapps.com/winfx/xaml/shared"
                      xmlns:enums="clr-namespace:Wix.Win8SetupBootstrapper.Enums"
                      Title="Installation"
                      Width="450"
                      Height="600"
                      mc:Ignorable="d" ResizeMode="NoResize" ShowMinButton="False"
                      WindowStartupLocation="CenterScreen"
                      d:DataContext="{d:DesignInstance viewModels:RootViewModel }">
    <controls:MetroWindow.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatButton.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
                <ResourceDictionary
                    Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
                <ResourceDictionary
                    Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedTabControl.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        </ResourceDictionary>
    </controls:MetroWindow.Resources>
    <i:Interaction.Behaviors>
        <behaviours:BorderlessWindowBehavior ResizeWithGrip="False" />
    </i:Interaction.Behaviors>
    <DockPanel LastChildFill="True">
        <TextBlock Height="50" Margin="15,15,0,0" Text="Installation" FontSize="30" DockPanel.Dock="Top" />
        <Separator Height="2" DockPanel.Dock="Top" />

        <StackPanel Margin="0,0,0,20" HorizontalAlignment="Left" VerticalAlignment="Stretch"
                    Orientation="Horizontal" DockPanel.Dock="Bottom">
            <StackPanel Orientation="Horizontal">
                <StackPanel.Style>
                    <Style TargetType="{x:Type StackPanel}">
                        <Setter Property="Visibility" Value="Collapsed" />
                        <Style.Triggers>
                            <DataTrigger Value="{x:Static enums:BurnInstallationState.NotPresent}"
                                         Binding="{Binding BurnInstallationState}">
                                <Setter Property="Visibility" Value="Visible" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </StackPanel.Style>
                <Button Width="80" Margin="150,0,0,0" HorizontalAlignment="Left" IsCancel="True"
                        Content="{Binding CurrentControl.DataContext.CancelButtonText}"
                        Command="{Binding CurrentControl.DataContext.CancelCommand}"
                        Visibility="{Binding CurrentControl.DataContext.CancelButtonVisible, Converter={StaticResource BooleanToVisibilityConverter}}" />
                <Button Width="80" Margin="20,0,0,0" IsDefault="True"
                        Content="{Binding CurrentControl.DataContext.BackButtonText}"
                        Command="{Binding CurrentControl.DataContext.BackCommand}"
                        Visibility="{Binding CurrentControl.DataContext.BackButtonVisible, Converter={StaticResource BooleanToVisibilityConverter}}" />
                <Button Width="80" Margin="20,0,0,0" IsDefault="True"
                        Content="{Binding CurrentControl.DataContext.NextButtonText}"
                        Command="{Binding CurrentControl.DataContext.NextCommand}"
                        Visibility="{Binding CurrentControl.DataContext.NextButtonVisible, Converter={StaticResource BooleanToVisibilityConverter}}" />
            </StackPanel>

            <StackPanel Orientation="Horizontal">
                <StackPanel.Style>
                    <Style TargetType="{x:Type StackPanel}">
                        <Setter Property="Visibility" Value="Collapsed" />
                        <Style.Triggers>
                            <DataTrigger Value="{x:Static enums:BurnInstallationState.Present}"
                                         Binding="{Binding BurnInstallationState}">
                                <Setter Property="Visibility" Value="Visible" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </StackPanel.Style>
                <Button Width="80" Margin="150,0,0,0" Command="{Binding RepairCommand}" Content="Repair" />
                <Button Width="80" Margin="20,0,0,0" Command="{Binding UninstallCommand}" Content="Uninstall" />
            </StackPanel>
        </StackPanel>
        <Separator Height="2" Margin="0,0,0,20" DockPanel.Dock="Bottom" />
        <controls:TransitioningContentControl Transition="{Binding TransitionType}" Content="{Binding CurrentControl}" />
    </DockPanel>
</controls:MetroWindow>